﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SurveySystem.GUI.Components;

namespace SurveySystem.GUI.Forms
{
    public partial class SurveyMainForm : Form
    {
        public SurveyMainForm()
        {
            InitializeComponent();

        }

        /// <summary>
        /// The background colour of the theme
        /// </summary>
        public Color ThemeBackColor { get { return this.BackColor; } set { this.BackColor = value; } }

        /// <summary>
        /// The foregrounds colour of the theme
        /// </summary>
        public Color ThemeForeColor { get { return this.ForeColor; } set { this.ForeColor = value; } }

        /// <summary>
        /// Converts <paramref name="controls"/> to use the current theme
        /// </summary>
        /// <param name="controls">The list of controls to convert to use the current theme</param>
        public void ConvertToTheme(Control.ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                // If the control is a button, reverse the colours so the button stands out
                if (control is Button)
                {
                    control.ForeColor = ThemeBackColor;
                    control.BackColor = ThemeForeColor;
                }
                else
                {
                    control.BackColor = ThemeBackColor;
                    control.ForeColor = ThemeForeColor;
                }
            }
        }

        /// <summary>
        /// Converts <paramref name="view"/> to use the current theme
        /// 
        ///  - Required as passing AnswerViews to the above function does strange things...
        /// 
        /// </summary>
        /// <param name="view">The AnswerView to convert to use the current theme</param>
        public void ConvertToTheme(AnswerView view)
        {
            view.BackColor = ThemeBackColor;
            view.ForeColor = ThemeForeColor;
        }

    }
}
